package com.anrongtec.zcpt.view;

import android.content.Context;
import android.support.v4.view.ViewPager;
import android.util.AttributeSet;
import android.view.MotionEvent;

/**
 * 自定义viewpager
 * 控制是否滑动
 * @author cxy
 *
 */
public class MyViewPager extends ViewPager {  
	  
    private boolean scrollble = true;  
  
    public MyViewPager(Context context) {  
        super(context);  
    }  
  
    public MyViewPager(Context context, AttributeSet attrs) {  
        super(context, attrs);  
    }  
  
  
    @Override  
    public boolean onTouchEvent(MotionEvent ev) {  
        if (!scrollble) {  
            return true;  
        }  
        return super.onTouchEvent(ev);  
    }  
  
    public boolean isScrollble() {  
        return scrollble;  
    }  
    
    /**
     * 设置是否滑动
     * @param scrollble
     */
    public void setScrollble(boolean scrollble) {  
        this.scrollble = scrollble;  
    }  
}  
